import java.util.Scanner;

public class Array {
    public static void main(String[] args) {
        Scanner stdIn=new Scanner(System.in);
        System.out.println("元素的个数：");
        //int n=stdIn.nextInt();//读入元素的个数
        int[] a=new int[]{1,2,3,4,5};//创建数组
        int sum=0;


        for (int i=0;i<a.length;i++)
        { System.out.println("a["+i+"]"+"="+a[i]);
            sum+=a[i];

        }

        System.out.println("sum is "+sum);

    }
}
